Generative Adversarial Networks (GANs) are a class of artificial intelligence algorithms used in unsupervised machine learning, implemented by a system of two neural networks contesting with each other in a game theoretic scenario. This method was introduced by Ian Goodfellow and his colleagues in 2014. GANs are used for generating data that is similar to some known input data. These networks are called generative because they generate new data instances, and adversarial because they use a game theory scenario to learn.
Generator (G): It learns to generate plausible data. The input to the Generator is a noise vector, , drawn from a predefined noise distribution (e.g., Gaussian distribution). This randomness is what allows the Generator to produce a variety of outputs.
Discriminator (D): It learns to distinguish between instances of real data and fake data produced by the Generator. Its job is to estimate the probability that a given input data is real.
The core idea behind training GANs is to use a game-theoretic approach where the Generator and the Discriminator have competing objectives. The loss functions capture these objectives.
The Discriminator's goal is to correctly classify real data as real and fake data (generated by the Generator) as fake. Its loss function is typically a Binary Cross-Entropy (BCE) loss, which for a given batch of data can be detailed as:
In practice, this loss is split into two parts:
The Generator's goal is to produce data that the Discriminator will mistakenly classify as real. Its loss can also use the Binary Cross-Entropy (BCE) form, focusing on fooling the Discriminator:
Here, the Generator tries to maximize the likelihood of the Discriminator being wrong, meaning it wants to be as close to 1 as possible, indicating that the Discriminator thinks the fake data is real.
Update Discriminator (D): Train to maximize its ability to differentiate real data from fake. This involves optimizing to recognize real data as real and generated data as fake.
Update Generator (G): Train to minimize by generating data that will classify as real. This step uses the gradients from to update , making more realistic.
Get the latest updates, exclusive content and special offers delivered directly to your mailbox. Subscribe now!